#include<iostream>
using namespace std;
int n, k;
int main()
{
	cin >>n >> k;
	int mod = n % k;
	if (mod == 0) cout << k << endl;
	else cout << k - mod;
	return 0;
}